
<!DOCTYPE html>
<html lang="zh-cn">
<head><meta name="generator" content="Hexo 3.8.0">
    <title>Javascript 方法 - Admui 开发文档</title>
    <meta charset="utf-8">
    <meta name="keywords" content="admui,admui官网,admui框架,通用后台管理系统,后台框架,ui框架">
    <meta name="description" content="Admui 是一个基于最新 Web 技术的企业级通用管理系统快速开发框架，可以帮助企业极大的提高工作效率，节省开发成本，提升品牌形象">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
    <!--[if lte IE 9]>
    <meta http-equiv="refresh" content="0; url='http://www.admui.com/ie'" />
    <![endif]-->
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Admui">
    <meta name="msapplication-TileImage" content="http://cdn.admui.com/site/img/app/icon-72@x2.png">
    <meta name="msapplication-TileColor" content="#395b81">
    <link rel="apple-touch-icon-precomposed" href="http://cdn.admui.com/site/img/app/icon-72@x2.png">
    <link rel="shortcut icon" href="http://cdn.admui.com/site/img/app/favicon.png">
    <meta name="msapplication-TileColor" content="#62a8ea">
    <script>
        window.PAGE_TYPE = "ui"
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?cd758c4c82a4964836712308cb782b12";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
    <link rel="stylesheet" href="http://cdn.admui.com/docs/v2/css/page.css">
</head>
<body>
<div id="mobile-bar">
    <a class="menu-button"></a>
    <a class="logo" href="../index.html">Admui开发文档</a>
    <select class="version-select">
        <option value="basic" selected>基础版</option>
        <option value="pjax">pjax版</option>
        <option value="iframe">iframe版</option>
    </select>
</div>
<div id="header">
    <a id="logo" href="../index.html">
        <img src="http://cdn.admui.com/docs/common/images/logo.svg"> <span>Admui 开发文档</span>
    </a>
    <select class="version-select">
        <option value="basic" selected>基础版</option>
        <option value="pjax">pjax版</option>
        <option value="iframe">iframe版</option>
    </select>
    <ul id="nav">
        <li>
    <a href="../index.html" class="nav-link">首页</a>
</li>
<li>
    <a href="../guide/index.html" class="nav-link">介绍</a>
</li>
<li>
    <a href="index.html" class="nav-link current">UI</a>
</li>
<li>
    <a href="../java/index.html" class="nav-link">JAVA</a>
</li>
<li>
    <a href="../logs/index.html" class="nav-link">更新日志</a>
</li>
<li>
    <a href="../1.x/index.html" class="nav-link">v1版本</a>
</li>

    </ul>
</div>

<div id="main" class="fix-sidebar">
    
    
<div class="sidebar">
    <ul class="main-menu">
        <li>
    <a href="../index.html" class="nav-link">首页</a>
</li>
<li>
    <a href="../guide/index.html" class="nav-link">介绍</a>
</li>
<li>
    <a href="index.html" class="nav-link current">UI</a>
</li>
<li>
    <a href="../java/index.html" class="nav-link">JAVA</a>
</li>
<li>
    <a href="../logs/index.html" class="nav-link">更新日志</a>
</li>
<li>
    <a href="../1.x/index.html" class="nav-link">v1版本</a>
</li>

    </ul>
    <div class="list">
        <ul class="menu-root">
            
            <li>
                <a href="index.html" class="sidebar-link ">基本概述</a>
            </li>
            
            <li>
                <a href="themes.html" class="sidebar-link ">主题说明</a>
            </li>
            
            <li>
                <a href="build.html" class="sidebar-link ">构建工具</a>
            </li>
            
            <li>
                <a href="files.html" class="sidebar-link ">入口文件</a>
            </li>
            
            <li>
                <a href="structure.html" class="sidebar-link ">模板结构</a>
            </li>
            
            <li>
                <a href="hello-world.html" class="sidebar-link ">Hello world</a>
            </li>
            
            <li>
                <a href="style.html" class="sidebar-link ">自定义样式</a>
            </li>
            
            <li>
                <a href="javascript.html" class="sidebar-link current ">Javascript 方法</a>
            </li>
            
            <li>
                <a href="components.html" class="sidebar-link ">UI 组件</a>
            </li>
            
            <li>
                <a href="plugins.html" class="sidebar-link ">第三方插件</a>
            </li>
            
            <li>
                <a href="icons.html" class="sidebar-link ">字体图标</a>
            </li>
            
            <li>
                <a href="code-guide.html" class="sidebar-link ">编码规范</a>
            </li>
            
        </ul>
    </div>
</div>


<div class="content ui with-sidebar">
    <h1>Javascript 方法</h1>
    <h2 id="主题结构"><a href="#%E4%B8%BB%E9%A2%98%E7%BB%93%E6%9E%84" class="headerlink" title="主题结构"></a>主题结构</h2><p>主要分为以下模块：</p>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">/src/themes/(布局名)/js/</span><br><span class="line">    └── site.js (布局模块)</span><br><span class="line"></span><br><span class="line">/src/themes/global/js/</span><br><span class="line">    ├── components/ (组件源文件)</span><br><span class="line">    ├── configs/ (基本配置信息)</span><br><span class="line">    ├── plugins/ (插件)</span><br><span class="line">    └── components.js (组件；components源文件合并文件)</span><br></pre></td></tr></table></figure>
<h2 id="布局配置"><a href="#%E5%B8%83%E5%B1%80%E9%85%8D%E7%BD%AE" class="headerlink" title="布局配置"></a>布局配置</h2><p>使用 <code>$.site</code> 对象来设置主题功能；如：菜单栏，栅格菜单，工具条，工具提示和组件等。</p>
<p>在 <code>/src/themes/(布局名)/js/site.js</code> 文件中我们对网站进行了初始化操作，您不需要再重新进行初始化操作。</p>
<h2 id="公用配置"><a href="#%E5%85%AC%E7%94%A8%E9%85%8D%E7%BD%AE" class="headerlink" title="公用配置"></a>公用配置</h2><p>在 <code>/src/themes/(布局名)/js/app.js</code> 文件中我们预置了一些公用的方法，您可以在需要的页面引入该文件，通过<code>window.App.run()</code>方法即可调用预置好的所有方法。当然您也可以选择需要的方法进行手动调用。</p>
<p>假如您需要增加公用方法，您可以直接在 <code>/src/themes/(布局名)/js/app.js</code> 文件中增加，也可以使用 <code>Window.App.extend(options)</code> 方法扩展公用方法。</p>
<p>示例代码：</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line">Window.App.extend(&#123;</span><br><span class="line">    getName: <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">        <span class="comment">// doSomething();</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<h2 id="基础配置"><a href="#%E5%9F%BA%E7%A1%80%E9%85%8D%E7%BD%AE" class="headerlink" title="基础配置"></a>基础配置</h2><h3 id="configs对象"><a href="#configs%E5%AF%B9%E8%B1%A1" class="headerlink" title="$.configs对象"></a><code>$.configs</code>对象</h3><p><code>$.configs</code> 对象可以配置一些常用变量在全局使用。</p>
<h4 id="1-configs-set-name-options"><a href="#1-configs-set-name-options" class="headerlink" title="1. $.configs.set(name, options)"></a>1. <code>$.configs.set(name, options)</code></h4><p>配置一项全局公用信息</p>
<ul>
<li><code>name</code>: 配置信息名称</li>
<li><code>options</code>: 配置信息；可以是一个字符串、数组、对象等。</li>
</ul>
<p>示例代码：</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line">$.configs.set(<span class="string">'site'</span>, &#123;</span><br><span class="line">    fontFamily: <span class="string">"Noto Sans, sans-serif"</span>,</span><br><span class="line">    ...</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<h4 id="2-configs-get-name-options-name"><a href="#2-configs-get-name-options-name" class="headerlink" title="2.$.configs.get(name[, options.name])"></a>2.<code>$.configs.get(name[, options.name])</code></h4><p>获取指定项全局公用信息配置</p>
<ul>
<li><code>name</code>: 配置信息名称</li>
<li><code>options.name</code>: 配置信息是一个对象时其中一项的名称</li>
</ul>
<p>示例代码：</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">var</span> fontFamily = $.configs.get(<span class="string">'site'</span>, <span class="string">'fontFamily'</span>);</span><br><span class="line"><span class="built_in">console</span>.info(fontFamily); <span class="comment">// 输出：'Noto Sans, sans-serif'</span></span><br></pre></td></tr></table></figure>
<h4 id="3-configs-extend-name-options"><a href="#3-configs-extend-name-options" class="headerlink" title="3. $.configs.extend(name[, options])"></a>3. <code>$.configs.extend(name[, options])</code></h4><p>扩展指定项全局公用信息配置</p>
<ul>
<li><code>name</code>: 配置信息名称</li>
<li><code>options</code>: 需要扩展到当前配置信息中的内容</li>
</ul>
<p>示例代码：</p>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">var font = $.configs.extend(&apos;site&apos;,&#123;</span><br><span class="line">    fontSize: &apos;18px&apos;,</span><br><span class="line">    color: &apos;#f60&apos;,</span><br><span class="line">    ...</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<p>我们也在 <code>global/configs/site-configs.js</code> 文件中通过 <code>$.configs.colors = {&quot;red&quot;: {&quot;100&quot;: &quot;#ffeaea&quot;}}</code> 配置了一些颜色信息，可以通过 <code>$.getColor(name[,level])</code> 方法使用。</p>
<h3 id="sessionStorage对象"><a href="#sessionStorage%E5%AF%B9%E8%B1%A1" class="headerlink" title="$.sessionStorage对象"></a><code>$.sessionStorage</code>对象</h3><p><code>$.sessionStorage</code> 对象可以更方便的使用sessionStorage对象存储方法。</p>
<h4 id="1-sessionStorage-set-name-options"><a href="#1-sessionStorage-set-name-options" class="headerlink" title="1. $.sessionStorage.set(name, options)"></a>1. <code>$.sessionStorage.set(name, options)</code></h4><p>配置一个指定的存储项</p>
<ul>
<li><code>name</code>: 存储项名称</li>
<li><code>options</code>: 存储信息；可以是一个字符串、数组、对象等。</li>
</ul>
<p>示例代码：</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line">$.sessionStorage.set(<span class="string">'site-style'</span>, &#123;</span><br><span class="line">    tab: <span class="literal">false</span>,</span><br><span class="line">    menu: <span class="string">'fold'</span>,</span><br><span class="line">    skin: <span class="string">'blue'</span>,</span><br><span class="line">    ...</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<h4 id="2-sessionStorage-get-name"><a href="#2-sessionStorage-get-name" class="headerlink" title="2.$.sessionStorage.get(name)"></a>2.<code>$.sessionStorage.get(name)</code></h4><p>获取指定项存储内容</p>
<ul>
<li><code>name</code>: 存储项名称</li>
</ul>
<p>示例代码：</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">var</span> siteStyle = $.sessionStorage.get(<span class="string">'site-style'</span>);</span><br><span class="line"><span class="built_in">console</span>.info(siteStyle); <span class="comment">// 输出：&#123;tab: false,menu: 'fold',skin: 'blue',...&#125;</span></span><br></pre></td></tr></table></figure>
<h4 id="3-sessionStorage-remove-name"><a href="#3-sessionStorage-remove-name" class="headerlink" title="3. $.sessionStorage.remove(name)"></a>3. <code>$.sessionStorage.remove(name)</code></h4><p>删除指定存储项</p>
<ul>
<li><code>name</code>: 存储项名称</li>
</ul>
<h3 id="getColor-name-level-方法获取-configs-colors中配置的颜色"><a href="#getColor-name-level-%E6%96%B9%E6%B3%95%E8%8E%B7%E5%8F%96-configs-colors%E4%B8%AD%E9%85%8D%E7%BD%AE%E7%9A%84%E9%A2%9C%E8%89%B2" class="headerlink" title="$.getColor(name[,level])方法获取$.configs.colors中配置的颜色"></a><code>$.getColor(name[,level])</code>方法获取<code>$.configs.colors</code>中配置的颜色</h3><ul>
<li><code>name</code>: 颜色名称</li>
<li><code>level</code>: 预置的颜色编码。</li>
</ul>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">var</span> color = $.getColor(<span class="string">'red'</span>, <span class="number">100</span>);</span><br><span class="line"><span class="built_in">console</span>.info(color); <span class="comment">// 输出：'#ffeaea'</span></span><br></pre></td></tr></table></figure>
<h2 id="组件"><a href="#%E7%BB%84%E4%BB%B6" class="headerlink" title="组件"></a>组件</h2><p>使用<code>$.components</code> 对象可以组件注册，注册后可以通过Data API 的方式使用一些插件和方法。您可以合理的组织您使用到的第三方插件。</p>
<h3 id="注册组件"><a href="#%E6%B3%A8%E5%86%8C%E7%BB%84%E4%BB%B6" class="headerlink" title="注册组件"></a>注册组件</h3><p>用法：<code>$.components.register(name, object)</code></p>
<p>代码示例：</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line">$.components.register(name, &#123;</span><br><span class="line">    mode: <span class="string">'init'</span>,</span><br><span class="line">    defauts:&#123;&#125;,</span><br><span class="line">    init: <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">        <span class="comment">// doSomething();</span></span><br><span class="line">    &#125;,</span><br><span class="line">    api: <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">        <span class="comment">// doSomethsing();</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<h4 id="参数："><a href="#%E5%8F%82%E6%95%B0%EF%BC%9A" class="headerlink" title="参数："></a>参数：</h4><p><code>name</code> 组件名称</p>
<p><code>{object}</code> 参数</p>
<ul>
<li><code>mode</code>: 组件注册的模式。有以下三种：<ul>
<li><code>default</code>: 组件最简单的调用方式，没有其他任何附加操作;</li>
<li><code>init</code>: 根据需求预置组件的使用方式，可以多次初始化;</li>
<li><code>api</code>: 根据需求预置组件的使用方式，只能初始化一次。</li>
</ul>
</li>
<li><code>defaults</code>: 组件的配置参数。</li>
<li><code>init | api</code>: 组件的初始化方法。</li>
</ul>
<h4 id="raty-组件-注册示例："><a href="#raty-%E7%BB%84%E4%BB%B6-%E6%B3%A8%E5%86%8C%E7%A4%BA%E4%BE%8B%EF%BC%9A" class="headerlink" title="raty 组件 注册示例："></a><code>raty 组件</code> 注册示例：</h4><blockquote>
<p>假如您使用的是自动构建版本，您需要在<code>/src/themes/global/components/</code>中增加该组件；并且，在<code>/build/configuration/config.json</code>中的<code>components</code>对象中添加属性，便于gulp构建。如下：</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">&quot;components&quot;: &#123;</span><br><span class="line">    &quot;raty&quot;: true</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>假如您使用的是基础源码或后端Java版本，可直接加入到<code>/public/themes/global/components/</code>中和<code>/public/themes/global/compontents.js</code>中。</p>
</blockquote>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line">$.components.register(<span class="string">"rating"</span>, &#123;</span><br><span class="line">    mode: <span class="string">"init"</span>,</span><br><span class="line">    defaults: &#123;</span><br><span class="line">        targetKeep: <span class="literal">true</span>,</span><br><span class="line">        icon: <span class="string">"font"</span>,</span><br><span class="line">        starType: <span class="string">"i"</span>,</span><br><span class="line">        starOff: <span class="string">"icon wb-star"</span>,</span><br><span class="line">        starOn: <span class="string">"icon wb-star orange-600"</span>,</span><br><span class="line">        cancelOff: <span class="string">"icon wb-minus-circle"</span>,</span><br><span class="line">        cancelOn: <span class="string">"icon wb-minus-circle orange-600"</span>,</span><br><span class="line">        starHalf: <span class="string">"icon wb-star-half orange-500"</span>,</span><br><span class="line">        cancelHint: <span class="string">'取消评分'</span>,</span><br><span class="line">        hints: [<span class="string">'很差'</span>, <span class="string">'差'</span>, <span class="string">'一般'</span>, <span class="string">'好'</span>, <span class="string">'非常好'</span>]</span><br><span class="line">    &#125;,</span><br><span class="line">    init: <span class="function"><span class="keyword">function</span> (<span class="params">context</span>) </span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (!$.fn.raty) <span class="keyword">return</span>;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">var</span> defaults = <span class="keyword">this</span>.defaults;</span><br><span class="line"></span><br><span class="line">        $(<span class="string">'[data-plugin="rating"]'</span>, context).each(<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">            <span class="keyword">var</span> $item = $(<span class="keyword">this</span>);</span><br><span class="line">            <span class="keyword">var</span> options = $.extend(<span class="literal">true</span>, &#123;&#125;, defaults, $item.data());</span><br><span class="line"></span><br><span class="line">            <span class="keyword">if</span> (options.hints) options.hints = options.hints.split(<span class="string">','</span>);</span><br><span class="line"></span><br><span class="line">            $item.raty(options);</span><br><span class="line">        &#125;);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<h3 id="组件初始化"><a href="#%E7%BB%84%E4%BB%B6%E5%88%9D%E5%A7%8B%E5%8C%96" class="headerlink" title="组件初始化"></a>组件初始化</h3><p><code>$.components.init([name])</code></p>
<p>对指定的注册组件初始化</p>
<ul>
<li><code>name</code>: 组件名称。</li>
</ul>
<blockquote>
<p>不提供组件名称时将默认调用所有注册组件初始化方法</p>
</blockquote>
<p>代码示例：</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line">$.components.init(<span class="string">'rating'</span>);</span><br></pre></td></tr></table></figure>
<blockquote>
<p>注意：</p>
</blockquote>
<p>admui已经做了组件的初始化工作，如果您需要根据具体需求单独使用组件，则需要删除 <code>(layout)/js/site.js</code> 中关于 <code>$.components</code> 的调用。</p>
<h3 id="关于组件配置参数"><a href="#%E5%85%B3%E4%BA%8E%E7%BB%84%E4%BB%B6%E9%85%8D%E7%BD%AE%E5%8F%82%E6%95%B0" class="headerlink" title="关于组件配置参数"></a>关于组件配置参数</h3><p>我们在组件注册时会预置一些配置参数，您也可以根据具体的使用情况修改它。当您没有使用我们的组件注册配置，又希望使用我们预置的配置参数时，可以通过如下方法获取配置。</p>
<h4 id="concatCpt-name-options-方法获取组件预置的配置参数并合并"><a href="#concatCpt-name-options-%E6%96%B9%E6%B3%95%E8%8E%B7%E5%8F%96%E7%BB%84%E4%BB%B6%E9%A2%84%E7%BD%AE%E7%9A%84%E9%85%8D%E7%BD%AE%E5%8F%82%E6%95%B0%E5%B9%B6%E5%90%88%E5%B9%B6" class="headerlink" title="$.concatCpt(name[,options])方法获取组件预置的配置参数并合并"></a><code>$.concatCpt(name[,options])</code>方法获取组件预置的配置参数并合并</h4><ul>
<li><code>name</code>: 组件名称</li>
<li><code>options</code>: 自定义配置</li>
</ul>
<p>代码示例：</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">var</span> <span class="keyword">default</span> = $.concatCpt(<span class="string">'rating'</span>, &#123;<span class="attr">name</span>:<span class="string">'自定义'</span>&#125;);</span><br><span class="line"><span class="built_in">console</span>.info(<span class="keyword">default</span>); <span class="comment">// 输出：&#123;name:'自定义',targetKeep: true,icon: "font",starType: "i",starOff: "icon wb-star",...&#125;</span></span><br></pre></td></tr></table></figure>
<blockquote>
<p>没有自定义配置时仅获取组件的预置配置参数</p>
</blockquote>
<p>如果您不需要我们的组件的解决方案，您也可以将其删除。</p>
<h3 id="调用方式"><a href="#%E8%B0%83%E7%94%A8%E6%96%B9%E5%BC%8F" class="headerlink" title="调用方式"></a>调用方式</h3><p>同BootStrap的Data API语法一样，在元素上添加 <code>data-{plugin}=&quot;{plugin name}&quot;</code> 和 <code>[data-{options}]</code> ，组件就会被初始化。</p>
<p>如下（页面加载完成后，评分插件就可以正常运行了。）：</p>
<figure class="highlight html"><table><tr><td class="code"><pre><span class="line">// 引用插件相关文件</span><br><span class="line"><span class="tag">&lt;<span class="name">link</span> <span class="attr">rel</span>=<span class="string">"stylesheet"</span> <span class="attr">href</span>=<span class="string">"assets/vendor/raty/jquery.raty.css"</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">"assets/vendor/raty/jquery.raty.js"</span>&gt;</span><span class="undefined"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br><span class="line"></span><br><span class="line">// 引用组件注册文件</span><br><span class="line"><span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">"assets/js/components/raty.js"</span>&gt;</span><span class="undefined"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br><span class="line"></span><br><span class="line">// 使用组件的DOM节点</span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"rating"</span> <span class="attr">data-score</span>=<span class="string">"4"</span> <span class="attr">data-plugin</span>=<span class="string">"rating"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h2 id="其他"><a href="#%E5%85%B6%E4%BB%96" class="headerlink" title="其他"></a>其他</h2><h3 id="serializeObject-方法"><a href="#serializeObject-%E6%96%B9%E6%B3%95" class="headerlink" title="serializeObject() 方法"></a><code>serializeObject()</code> 方法</h3><p>返回serializeArray的变形方法，序列化表格元素 (类似 ‘.serializeArray()’ 方法) 返回 JSON 数据结构数据。</p>
<p>返回的JSON对象结构如下：</p>
<figure class="highlight"><table><tr><td class="code"><pre><span class="line">&#123;name: '夏萱', sex: '女', phone: '13724539854', email: '1245345@qq.com'&#125;,</span><br></pre></td></tr></table></figure>
    
    <div class="page-links">
        
        <span><a href="style.html">&lang; 上一页：自定义样式</a></span>
        
        
        <span style="float:right"><a href="components.html">下一页：UI 组件 &rang;</a></span>
        
    </div>
    
    <div class="footer">
    &copy; 2015-2018
    <a href="http://www.admui.com/">Admui</a>
    ·
    上海畅控
</div>
</div>

    
</div>


<script src="https://cdn.staticfile.org/smooth-scroll/14.2.1/smooth-scroll.min.js"></script>
<script src="http://cdn.admui.com/docs/common/js/common.js"></script>

<script src="https://cdn.staticfile.org/fastclick/1.0.6/fastclick.min.js"></script>
<script>
    document.addEventListener('DOMContentLoaded', function () {
        FastClick.attach(document.body);
    }, false);
    (function(){
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        }
        else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

</body>
</html>
